from typing import List


# 盛最多水的容器
class Solution:
    def maxArea(self, height: List[int]) -> int:
        max_area = 0
        i = 0
        j = len(height) - 1

        while i <= j:
            min_height = min(height[i], height[j])
            area = min_height * (j - i)
            max_area = area if area > max_area else max_area
            if height[i] < height[j]:
                i += 1
            else:
                j -= 1
        return max_area

    @staticmethod
    def min(num1, num2):
        return num1 if num1 < num2 else num2


if __name__ == '__main__':
    solution = Solution()

    testCase0 = [1, 8, 6, 2, 5, 4, 8, 3, 7]
    print(solution.maxArea(testCase0))

    testCase0 = [1, 8, 6, 2, 5, 4, 8, 3, 1]
    print(solution.maxArea(testCase0))
